#include <iostream>
#include <vector>
using namespace std;
int main() {
    int m, n;
    cin >> n >> m;
    vector<vector<int>> a(n + 2, vector<int>(n + 2, 0));
    vector<vector<int>> b(n + 2, vector<int>(n + 2, 0));
    for(int i = 0; i < m; i++) {
        int x, y, l, r;
        cin >> x >> y >> l >> r;
        a[x][y] += 1;
        a[x][r + 1] -= 1;
        a[l + 1][y] -= 1;
        a[l + 1][r + 1] += 1;
    }
    for(int i = 1; i <= n; i++) {
        for(int j = 1; j <= n; j++) {
            b[i][j] = b[i - 1][j] + b[i][j - 1] -b[i - 1][j - 1] + a[i][j];
        }
    }
    for(int i = 1; i <= n; i++) {
        for(int j = 1; j <= n; j++) {
            cout << b[i][j] << " ";
        }
        cout << endl;
    }
    return 0;
}